<?php if (strtotime(date('Y-m-d')) <= $time): ?>
    <a 
       onclick="if (event.preventDefault) {event.preventDefault();} else {event.returnValue = false; }; $('.hasDatepicker').datepicker('setDate', '<?php echo date('d/m/Y', $time) ?>'); checkBlocks(); return false;">
        <span class="ui-button ui-widget ui-state-active ui-corner-all ui-button-text-only yvo-smallbutton yvo-datebutton">
            <span class="ui-button-text yvo-smalltext">
                <?php echo $day ?><br /><?php echo date('d/m', $time) ?>
            </span>
        </span>
    </a>
<?php else: ?>
    <span  class="ui-button ui-widget ui-state-active ui-corner-all ui-button-text-only ui-state-disabled yvo-disabled yvo-smallbutton yvo-datebutton " >
        <span class="ui-button-text yvo-smalltext"><?php echo $day ?><br /><?php echo date('d/m', $time) ?></span>
    </span>
<?php endif ?>